import 'package:flutter/material.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

class EyeDetailPage extends StatefulWidget {
  final Map<String, dynamic> data;

  EyeDetailPage({super.key, required this.data});

  @override
  _EyeDetailPageState createState() => _EyeDetailPageState();
}

class _EyeDetailPageState extends State<EyeDetailPage> {
  final List<String> typeList = ['流畅', '清晰', '高清'];
  var typeName = '流畅';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('云眼详情'),
        backgroundColor: Colors.transparent,
        flexibleSpace: Container(
          decoration: const BoxDecoration(
            image: DecorationImage(
              image: AssetImage('assets/images/home/home_topbg.png'),
              fit: BoxFit.cover,
            ),
          ),
        ),
      ),
      body: Column(
        children: [
          SizedBox(height: 15),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Padding(
                padding: const EdgeInsets.only(left: 10),
                child: Text(
                  widget.data['monitorName'] ?? '',
                  style: const TextStyle(
                    fontSize: 17,
                    color: Colors.black,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(right: 10),
                child: GestureDetector(
                  onTap: () {
                    TDPicker.showMultiPicker(context, title: '',
                        onConfirm: (selected) {
                      setState(() {
                        typeName = '${typeList[selected[0]]}';
                      });
                      Navigator.of(context).pop();
                    }, data: [typeList]);
                  },
                  child: Text(
                    typeName,
                    style: const TextStyle(fontSize: 17, color: Colors.black),
                  ),
                ),
              ),
            ],
          ),
          SizedBox(height: 15),
          Image.asset(
            'assets/images/cloud/eye_bg.png',
            fit: BoxFit.cover,
            width: double.infinity,
          ),
        ],
      ),
    );
  }
}
